<template>
  <pre v-highlightjs class="w-full h-full"><code class="w-full min-h-full">{{ text }}</code></pre>
</template>

<script setup>
import { useFileStore, useFlagStore } from '@/stores'
import http from '@/utils/http'
const fileStore = useFileStore()
const flagStore = useFlagStore()
const text = ref('')
onMounted(async () => {
  flagStore.setPreviewSpinner(true)
  const data = await http(fileStore.curFileInfo.url)
  text.value = data
  flagStore.setPreviewSpinner(false)
})

const loadHandle = () => {
  flagStore.setPreviewSpinner(false)
}
</script>

<style lang="scss" scoped>
@import './index.scss';
</style>
